﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Trackr.Core
{
	public class GenerateDummyData
	{
		public static void Generate(int minItemsPerDay, int maxItemsPerDay, DateTime startDate, DateTime endDate)
		{
			Trackr.Instance.ClearData();
			var days = endDate.Subtract(startDate).TotalDays;
			var currentDay = startDate;
			Random runningSeconds = new Random();
			Random itemsPerDay = new Random(1);
			while(currentDay < endDate)
			{
				int itemsCurrentDay = itemsPerDay.Next(minItemsPerDay, maxItemsPerDay);
				for (int index = 0; index < itemsCurrentDay; index++)
				{
					var ti = new Core.Entities.TimeItem();
					ti.StartDate = currentDay;
					ti.AddDuration(runningSeconds.Next(120, 7200));
					ti.Task = currentDay.ToString("MMM dd"); // +" - " + index;
					Trackr.Instance.AddNew(ti);
				}
				currentDay = currentDay.AddDays(1);
			}
		}
	}
}
